/*
 *    Copyright (c) 2018-2025, proj All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the proj developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: proj
 */
package com.ykht.proj.coupon.service.impl;

import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ykht.proj.coupon.entity.CnPerson;
import com.ykht.proj.coupon.handler.LoginHandler;
import com.ykht.proj.coupon.mapper.CnPersonMapper;
import com.ykht.proj.coupon.service.CnPersonService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 消费者用户表
 *
 * @author proj code generator
 * @date 2020-11-16 17:00:21
 */
@Service
@RequiredArgsConstructor
@Slf4j
public class CnPersonServiceImpl extends ServiceImpl<CnPersonMapper, CnPerson> implements CnPersonService {

	private final Map<String, LoginHandler> loginHandlerMap;

	@Override
	public Object getUserInfo(String inStr) {
		log.info("LoginHandler实现类：{}",loginHandlerMap);
		log.info("inStr:{}",inStr);
		String[] inStrs = inStr.split(StringPool.AT);
		String type = inStrs[0];
		String loginStr = inStrs[1];
		return loginHandlerMap.get(type).handle(loginStr);
	}
}
